home *** CD-ROM | disk | FTP | other *** search
/ Disc to the Future 2 / Disc to the Future Part II Programmer's Reference (Wayzata Technology)(6013)(1992).bin / MAC / THINKC / 5 / SOUND_KI / SKSAMPLE / SQUEEZEM.C next >
C/C++ Source or Header  |  1991-10-04  |  1KB  |  74 lines

  1. /*
  2. >>    SoundSqueeze utility for Project STORM
  3. >>
  4. >>    Copyright ⌐1990-1991, Juri Munkki
  5. >>
  6. >>    This program is meant to illustrate how
  7. >>    the sound kit can be used. It also does
  8. >>    the packing phase.
  9. */
  10.  
  11. /*
  12. >>    Use the following two defines to control
  13. >>    what this program does. Ugly, but simple.
  14. */
  15.  
  16. #define    no_COMPRESS
  17. #define    no_DYNAMIC
  18.  
  19. #include "Shuddup.h"
  20.  
  21. /*        NOTE:
  22. >>
  23. >>            If you can find something funny about the
  24. >>            routine DoInits, please contact me immediately.
  25. >>            Your help will be appreciated.
  26. >>
  27. */
  28. void    main()
  29. {
  30.     int        i;
  31.     long    ticker;
  32.     Handle    filename;
  33.     
  34.     DoInits();
  35.  
  36.     filename = (Handle)GetString(128);
  37.     HLock(filename);
  38.     OpenResFile(*filename);
  39.  
  40. #ifdef    COMPRESS
  41.     SetPort(GetNewWindow(1000,0,(void *)-1));
  42.  
  43.     DoCompress();
  44. #else
  45.     ticker=TickCount();
  46.     InitSoundKit();
  47.     ticker=TickCount()-ticker;
  48.     SKVolume(8);
  49.  
  50. #ifndef DYNAMIC
  51.     for(i=0;i<NumSounds;i++)
  52.     {    PlayA(i,999-i);
  53.         while(!Button());
  54.         while(Button());
  55.     }
  56. #else    
  57.     {    Handle    thedata;
  58.  
  59.         /*    Load a sampled sound resource (SoundWave format)        */    
  60.         OpenResFile("\pDynamic Sample Resource");
  61.         thedata = GetResource('wave',128);
  62.         DetachResource(thedata);
  63.         SKProcessHandle(thedata);
  64.  
  65.         /*    Play the sampled sound resource.                        */
  66.         HLock(thedata);
  67.         SKPlayHandleA(thedata);
  68.         while(!Button());
  69.     }
  70. #endif
  71.     
  72.     CloseSoundKit();
  73. #endif
  74. }